import * as THREE from "three"
import configConst from "../constant/config.const"
import renderOrderEnum from "../enum/renderOrder.enum"
import TextureLoader from "../loader/TextureLoader"
export default class PinAnchorMesh extends THREE.Mesh {
  static anchorTexture: THREE.Texture
  constructor(e) {
    super(
      new THREE.PlaneBufferGeometry(configConst.PlaneBufferGeometryConfg.anchor.size, configConst.PlaneBufferGeometryConfg.anchor.size),
      new THREE.MeshBasicMaterial({
        depthTest: !1,
        depthWrite: !1,
        transparent: !0,
        map: PinAnchorMesh.getTexture(),
        side: THREE.DoubleSide
      })
    )
    this.visible = !1
    this.layers.mask = e.mask
    this.renderOrder = renderOrderEnum.pins
  }
  static getTexture() {
    PinAnchorMesh.anchorTexture = PinAnchorMesh.anchorTexture || TextureLoader("./images/pinAnchor.png")
    return PinAnchorMesh.anchorTexture
  }
}
